from ctypes import *

#load the shared object file
somesummer = CDLL('./somesum.so')

n = 2_140_000_000

#Find sum of integers
result_somesum = somesummer.some_sum(c_ulonglong(n),c_ulonglong(0))
print("Sum =", result_somesum)

# print("Sum_1 (formula) =", int(n*(n+1)/2))
# print("Sum_2 (formula) =",int(n*(n+1)*(2*n+1)/6))
# print("Sum_3 (formula) =",int((n*(n+1))**2/4))

# delta = (n*(n+1)/2)**2 - int(result_somesum)
# print("Delta = ", delta)

# max for m = 0: n ~ 2_140_000_000 ~ 18 sec
# max for m = 1: n = 65_535
# max for m = 2: n = 1860
# max for cubes: n = 303